using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BusinessRules;
using DataAccess;

public partial class EpsPendientes : PageBase
{
    private DataTable FinAccionEPeDataTable
    {

        get
        {

            DataTable objTable = null;
            if (Cache[FinAccionEpeData.FIN_ACCION_EPE_TABLE + Session.SessionID] != null)
                objTable = (DataTable)Cache[FinAccionEpeData.FIN_ACCION_EPE_TABLE + Session.SessionID];
            return objTable;
        }

        set
        {
            if (value != null)
            {
                Cache.Insert(FinAccionEpeData.FIN_ACCION_EPE_TABLE + Session.SessionID, value);
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            BindDatosEpes();
        }

        ////////////////////////////
        // cargar Epes de cache //
        ////////////////////////////
        
        if (FinAccionEPeDataTable != null)
        {
            if (FinAccionEPeDataTable.Rows.Count > 0)
            {
                gidvAccionEpeDev.DataSource = FinAccionEPeDataTable.DefaultView;
                gidvAccionEpeDev.DataBind();
            }
        }
    }


    #region BindDatosEpes

    private void BindDatosEpes()
    {
        FinAccionEpe objFinAccionEpe = new FinAccionEpe(ConfigurationManager.AppSettings["Conn"]);
        FinAccionEpeData objFinAccionEpeData = objFinAccionEpe.ConsultarEpsPendientesPorUsuID(Usuario.UsuId);
        FinAccionEPeDataTable = objFinAccionEpeData;
        gidvAccionEpeDev.DataSource = objFinAccionEpeData.DefaultView;
        gidvAccionEpeDev.DataBind();
    }

    #endregion
    protected void gidvAccionEpeDev_ProcessColumnAutoFilter(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewAutoFilterEventArgs e)
    {

    }
    protected void gidvAccionEpeDev_AutoFilterCellEditorCreate(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorCreateEventArgs e)
    {

    }
    protected void gidvAccionEpeDev_AutoFilterCellEditorInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgs e)
    {

    }
    protected void gidvAccionEpeDev_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e)
    {

    }
    protected void lnkEpe_Click(object sender, EventArgs e)
    {
        string ep = "";
        string a = "";
        string r = "";
        List<object> keyValuese = gidvAccionEpeDev.GetSelectedFieldValues("FAE_ID");
        foreach (object key in keyValuese)
        {
            ep = key.ToString();
        }

        List<object> keyValuesa = gidvAccionEpeDev.GetSelectedFieldValues("ACC_ID");
        foreach (object key in keyValuesa)
        {
            a = key.ToString();
        }

        List<object> keyValuesr = gidvAccionEpeDev.GetSelectedFieldValues("PLN_ID");
        foreach (object key in keyValuesr)
        {
            r = key.ToString();
        }

        //crearContextItems();
        Server.Transfer("EpeEje.aspx?SSM_ID=20&e=" + ep + "&a=" + a + "&r=" + r, true);
    }
}
